package net.sxnic.ugr.resource;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class ResourceUtils {

	public static final String[] BASIC_OBJECT_OPERATRION = new String[] {
			"browse", "create", "edit", "save", "view", "preCreate", "delete" };

	/**
	 * struts 映射中 实体和基本方法之间的间隔符
	 */
	public static final String OBJECT_OPERATION_SEPARATOR = "_";

	public static List<Resource> findResourceFromStrutsXml(String filepath) {

		return null;
	}

	public static List<Resource> createObjectOperationResource(
			String namespace, String... objects) {

		if (objects == null || objects.length == 0) {
			return null;
		}

		if (StringUtils.isBlank(namespace)) {
			namespace = "/";
		}

		List<Resource> list = new ArrayList<Resource>();
		Resource r = null;

		for (String obj : objects) {
			for (String opt : BASIC_OBJECT_OPERATRION) {
//				r = new Resource();
//				r.setPath(namespace + obj.toLowerCase()
//						+ OBJECT_OPERATION_SEPARATOR + opt);
//				r.setName(r.getPath());
			}
		}

		return null;
	}
}
